#include "AST_Builder.h"
#include <iostream>


//
AST_Builder* AST_Builder::obj = NULL;

AST_Builder::AST_Builder(){
	this->_ast = AST::getInstance();
		_state.currProcNode = NULL;
		_state.numProcs = 0;
		_state.numStmts = 0;
		//memset( _state.newNodeLinks, 0, sizeof(_state.newNodeLinks));
	};

AST_Builder* AST_Builder::getInstance() {
		if( !AST_Builder::obj )
			obj = new AST_Builder();
		return obj;
	};
void AST_Builder::listAllStmts() {
	int n = _ast->numStmts();
	cout << "Listing all statements:\n ";
	for (int i=0; i<n; i++ ) {
		cout << _ast->StmtAt(i)->getStmtIndex() << ":"  << _ast->StmtAt (i)->getStmtType() << " ";
	}
	cout << endl;
};